package com.jiyun.controller;

import com.jiyun.entity.day05.ContestDTO;
import com.jiyun.feign.ContestFeign;
import com.jiyun.vo.ResultResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Title: ContestController
 * @Author 杜瑞
 * @Date 2023/8/28 11:27
 */
@RestController
@RequestMapping("contest")
public class ContestController {
    @Autowired
    private ContestFeign contestFeign;

    @PostMapping("findAll")
    public ResultResponse findAll(@RequestBody ContestDTO contestDTO){
        try {
            ResultResponse all1 = contestFeign.findAll1(contestDTO);
            return ResultResponse.success(all1);
        } catch (Exception e) {
            e.printStackTrace();
            return ResultResponse.error();
        }
    }
    @RequestMapping("findByJs")
    public ResultResponse findByJs(Integer id){
        try {
            ResultResponse js = contestFeign.findByJs(id);
            return ResultResponse.success(js);
        } catch (Exception e) {
            e.printStackTrace();
            return ResultResponse.error();
        }
    }

    @RequestMapping("findSj")
    public ResultResponse findSj(Integer id){
        try {
            ResultResponse js = contestFeign.findSj(id);
            return ResultResponse.success(js);
        } catch (Exception e) {
            e.printStackTrace();
            return ResultResponse.error();
        }
    }


}
